<?php
if(!check_manager_login()) exit('无权查看，请登录!');
require_once MODEL_PATH.DS.'Album.php';
$Album = new Album();
$album_id = isset($_GET['album_id'])?(int)$_GET['album_id']:'';

$photo_list = $Album->getPhotoListByAlbumId($album_id);
if($photo_list){
	foreach($photo_list as $photo){
		if(file_exists(SHOP_IMAGES.$photo['image'])){
			unlink(SHOP_IMAGES.$photo['image']);
		}
		if(file_exists(SHOP_IMAGES.$photo['thumbnail'])){
			unlink(SHOP_IMAGES.$photo['thumbnail']);
		}
	}
}
$photo_ids = get_array($photo_list,'id','string');
$res = $Album->delPhotoByIds($photo_ids);
$result = $Album->delAlbumByid($album_id);

if($result){
	redirect('index.php?mod=album&act=list','删除相册成功！');
}